package security.SingleAccessPoint;

import security.Roles.*;
import OOJ.Console;

import rental.Program;

/**
 * 
 */
public aspect ConsoleAccessPoint 
extends SingleAccessPointAspect 
{
	
	declare parents: rental.Program implements SingleAccessPoint; 
	
	public void Program.returnMessage(String message) {
		Console.println(message);
	}
	
	public AuthenticationToken Program.getAuthentication(String message) {
		String user, password;
		System.out.println(message);
		user = Console.readString("User: ");
		password = Console.readString("Password: ");
		return new SimpleAuthenticationToken(user, password);
	}
	
	public pointcut selectAccessMethods():
		call (private void exec*(..));
	
	public pointcut singleAccessPoint(SingleAccessPoint sap): 
		cflowbelow (call (void rental.Program.run() )) && this(sap);
	
//	before (SingleAccessPoint sap) : secureSystem(sap) {
//		Console.println(thisJoinPoint.toLongString());
//	}
}
